﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using WebApp.Models;

namespace WebApp.Entities
{
    [Table("operation")]
    public class Operation
    {
        public long Id { get; set; }
        [Required]
        public int AppId { get; set; }
        [Required]
        [MaxLength(12)]
        public string CollectorCode { get;  set; }
        [Required]
        [MaxLength(12)]
        public string MeterCode { get;  set; }
        [Required]
        [MaxLength(8)]
        public string Password { get;  set; }
        [MaxLength(50)]
        public string RequestId { get;  set; }
        [Required]
        [MaxLength(4)]
        public string Command { get;  set; }
        [MaxLength(255)]
        public string CallbackUrl { get;  set; }
        /// <summary>
        /// 电量刻度
        /// </summary>
        public decimal ActivePower { get; set; }
        /// <summary>
        /// 可以查询的命令Id
        /// </summary>
        [Required]
        [MaxLength(50)]
        public string QueryId { get; set; }
        [Required]
        public IoTCmdStatus Status { get;  set; }
        [Required]
        public int TryCount { get;  set; }
        public DateTime CreateTime { get;  set; }
        public DateTime ExcuteTime { get;  set; }
        [ForeignKey("AppId")]
        public virtual Application App { get; set; }
    }
}
